<?php  

    $nb= 0 ;   
    include '../include/connectBDD.php';
    // Regex mail

        $req = "select login,mdp,idU from user where login = '".mysql_real_escape_string(strtolower($_GET['login']))."' AND mdp = '".mysql_real_escape_string(md5($_GET['pwd']))."' AND valider = 1; " ; 
        $res = mysql_query($req) ; 
        $result = mysql_fetch_array($res) ; 
        $nb = mysql_num_rows($res) ; 
        mysql_free_result($res) ; 
  
    
    if($nb == 1)
    {
        $_SESSION['id'] = $result['idU'] ;  
        echo '1' ; 
    }
    else
    {      
        echo 'Mot de passe invalide'  ; 
    }    
    
?>